//
// qiankun 实例
import {
  initGlobalState,
  MicroAppStateActions,
  registerMicroApps,
  // start,
} from 'qiankun'
import { initActions } from './Action'

// 子应用
const subApps = [
  {
    name: 'sub-react',
    entry: '//localhost:7013',
    container: '#sub-container',
    activeRule: '/subreact',
  },
]

const lifecycle = {
  beforeLoad: [async (app: any) => console.log('before load', app.name)],
  beforeMount: [async (app: any) => console.log('before mount', app.name)],
  afterMount: [async (app: any) => console.log('after mount', app.name)],
}
// 注册子应用
// registerMicroApps(subApps)
registerMicroApps(subApps, lifecycle)

// 初始化qiankun全局状态
const actions: MicroAppStateActions = initGlobalState({})

// 对actions进行封装
initActions(actions)

// 启动 qiankun 微服务
// start()
